using System.Collections.Generic;

namespace Scrummer.Models
{
	public class Priority
	{
		private const string HighString = "High";
		private const string MediumString = "Medium";
		private const string LowString = "Low";
		private const string BlankString = "";

		private static IList<Priority> all;
		private string name;

		public string Name
		{
			get { return name; }
			set { name = value; }
		}

		private Priority(string name)
		{
			this.name = name;
		}

		public static Priority High = new Priority(HighString);
		public static Priority Medium = new Priority(MediumString);
		public static Priority Low = new Priority(LowString);
		public static Priority Blank = new Priority(BlankString);

		public static IList<Priority> All
		{
			get
			{
				if (all == null)
					InitializeList();

				return all;
			}
		}

		public static Priority Decode(string name)
		{
			if (name == HighString)
				return High;
			else if (name == MediumString)
				return Medium;
			else if (name == LowString)
				return Low;
			else
				return Blank;
		}

		private static void InitializeList()
		{
			all = new List<Priority>();

			all.Add(Blank);
			all.Add(High);
			all.Add(Medium);
			all.Add(Low);
		}
	}
}
